import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os

resultspath = '/home/kexin/phdwork/work4-tii/code/save/results'



# isdb-supervised-10trials
sns.set_theme()
result = 'isdb-supervised-10trials-trend.csv'
data = pd.read_csv(os.path.join(resultspath, result))
supervised = data.loc[:,['acc_supervised','label_ratio']]
#supervised_fustion = data.loc[:,['acc_supervisedfusion', 'label_ratio']]
fig, axes = plt.subplots(1, 1, figsize=(10, 6))
f1 = sns.boxplot(x="label_ratio", y="acc_supervised", data=supervised, saturation=1, linewidth=1.5,  color="coral")
sns.swarmplot(x="label_ratio", y="acc_supervised", data=supervised, color=".2")
f1.set(ylim=(0.4, 0.95))
'''f2 = sns.boxplot(x="label_ratio", y="acc_supervisedfusion", data=supervised_fustion, saturation=1, linewidth=1.5, ax=axes[1])
sns.swarmplot(x="label_ratio", y="acc_supervisedfusion", data=supervised_fustion, color=".2", ax=axes[1])
f2.set(ylim=(0.4, 0.95))'''
savename = result[0:-3] + 'eps'
#plt.show()
plt.savefig(os.path.join(resultspath, savename))


# CWRU compare
sns.set_theme()
result = 'cwru-compare.csv'
data = pd.read_csv(os.path.join(resultspath, result))
fig, axes = plt.subplots(1, 1, figsize=(10,6))
f = sns.barplot(data=data, x="method", y='acc', color="coral", capsize=.2, linewidth=1, errcolor='black')
f.set(ylim=(0.0, 1.05))
savename = result[0:-3] + 'eps'
#plt.show()
plt.savefig(os.path.join(resultspath, savename))

